﻿#pragma once

#include <QtWidgets/QMainWindow>
#include "ui_PowerOutput.h"

#include <QFileDialog>
#include <QTimer>
#include <QStringList>
#include <QDateTime>
#include <QIcon>
#include <QFile>
#include <QHostAddress>
#include <QTcpSocket>
#include <QValidator>
#include <QIntValidator>
#include <QQueue>

typedef enum
{
	LOGTYPE_ERROR,
	LOGTYPE_WARNING,
	LOGTYPE_MESSAGE,
	LOGTYPE_DEBUG
}LOGTYPE;
typedef struct
{
	QString strDt;
	QString strType;
	QString strLog;
}tagLogInfo;

class PowerOutput : public QMainWindow
{
    Q_OBJECT

public:
    PowerOutput(QWidget *parent = Q_NULLPTR);
	~PowerOutput();
private:
    Ui::PowerOutputClass ui;

public:
	void AddLog(LOGTYPE TYPE, const QString &strLog);
	void SendCmd(const QString &strCmd);
private slots:
    void on_pushButton_TCPConnect_clicked();

    void on_pushButton_Output_clicked();

private:
	QQueue<tagLogInfo> m_QueueLog;//日志更新缓冲区
	QTimer m_LogUpdateTimer;
	bool m_bUpdateFlag;
	bool InitTcpNet(const QHostAddress &HostAddress  ,const quint16 usPort);
	QTcpSocket m_TcpSocket;
signals:
	void signal_CloseNet();
};
